package com.tool.btn;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
import java.util.List;

import javax.swing.SwingConstants;

import com.tool.ModerateTask.Hero;
import com.tool.ModerateTask.Task;
import come.tool.JDialog.TiShiUtil;
import come.tool.map.XLPath;
import org.apache.commons.lang.math.NumberUtils;
import org.come.Frame.*;
import org.come.Jpanel.*;
import org.come.bean.ChatBean;
import org.come.bean.RoleShow;
import org.come.bean.Role_bean;
import org.come.entity.Friendtable;
import org.come.entity.RoleSummoning;
import org.come.mouslisten.ChangeMouseSymbolMouslisten;
import org.come.mouslisten.GoodsMouslisten;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.thread.TimeControlRunnable;
import org.come.until.*;

import com.tool.image.ImageMixDeal;
import com.tool.image.ManimgAttribute;
import com.tool.imagemonitor.PlayerMonitor;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyQdModeJFrame;

import come.tool.Fighting.FightingMixDeal;
import come.tool.handle.HandleState;

public class RoleCaoZuoBtn extends MoBanBtn {

    private int index;
    private AddFriendJpanel addFriendJpanel;
    private Object BigDecimal;
    private String[] taskIds;






    public RoleCaoZuoBtn(String iconpath, int type, Color[] colors, Font font, String text, int index) {
        super(iconpath, type, colors);
        this.setText(text);
        setFont(font);
        setVerticalTextPosition(SwingConstants.CENTER);
        setHorizontalTextPosition(SwingConstants.CENTER);
        this.index = index;
    }

    public RoleCaoZuoBtn(String iconpath, int type, Color[] colors, Font font, String text, int index,String mm) {
    	super(iconpath, type);
    	this.setText(text);
//    	this.setFont(font);
    	setVerticalTextPosition(SwingConstants.CENTER);
    	setHorizontalTextPosition(SwingConstants.CENTER);
    	this.index = index;
    }

    public RoleCaoZuoBtn(String iconpath, int type, String text, int index, Color[] colors) {
        super(iconpath, type, colors);
        this.setText(text);
        if (text.equals("搜索") || text.equals("断交")) {
            setFont(UIUtils.TEXT_FONT11);
        } else {
            setFont(UIUtils.TEXT_HY16);
        }
        setVerticalTextPosition(SwingConstants.CENTER);
        setHorizontalTextPosition(SwingConstants.CENTER);
        this.index = index;
    }

    public RoleCaoZuoBtn(String iconpath, int type, int index, AddFriendJpanel addFriendJpanel) {
        super(iconpath, type);
        this.index = index;
        this.addFriendJpanel = addFriendJpanel;
    }








    @Override
    public void chooseyes() {
        // TODO Auto-generated method stub

    }

    @Override
    public void chooseno() {
        // TODO Auto-generated method stub

    }
    @Override
    public void nochoose(MouseEvent e) {
        WorldTestsmallmapJframe.getWorldTestsmallmapJframe().getWorldTestsmallmapJpanel().clearTps();
        if ("确认".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 0) {
            sureRenMing();
        } else if ("取消".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 1) {
            FormsManagement.HideForm(37);
        } else if ("取消".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 3) {
            FormsManagement.HideForm(41);
        } else if (FightingMixDeal.State == HandleState.USUAL && index == 3) {
            sureZhuanSheng();
        }else if ("吐出内丹".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 0
                && UserMessUntil.getChosePetMes() != null) {
            spitOutNeDan();
        } else if ("转换经验".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 0) {
            conversionExp();
        } else if ("发送".equals(this.getText()) && index == 5) {
            sendMessageUntil();
            if (!FriendChatMessageJpanel.closeCk) {
                FormsManagement.HideForm(56);
            }
        } else if ("取消".equals(this.getText()) && index == 5) {
            FriendChatMessageJframe.getFriendChatMessageJframe().getJpanel().getSetwords().setText("");
            FormsManagement.HideForm(56);
        } else if (index == 6) {
            Role_bean bean = AddFriendJframe.getAddFriendJframe().getAddFriendJpanel().getRole();
            if (bean == null) {
                return;
            }
            if ("加为好友".equals(this.getText())) {
                PlayerMonitor.addFriend(bean.getRole_id(), bean.getRolename());
            } else if ("申请入队".equals(this.getText())) {
                PlayerMonitor.teamApply(bean.getRole_id());
            }
        } else if ("搜索".equals(this.getText()) && index == 7) {
            String text = AddFriendJframe.getAddFriendJframe().getAddFriendJpanel().getFieldText();
            String type = AddFriendJframe.getAddFriendJframe().getAddFriendJpanel().getTj();
            String msg = null;
            if ("数字ID".equals(type)) {
                try {
                    Integer.parseInt(text);
                    msg = Agreement.getAgreement().searcahChatRoleIdAgreement(text);
                } catch (Exception e2) {
                    // TODO: handle exception
                    return;
                }
            } else if ("昵称".equals(type)) {
                msg = Agreement.getAgreement().searcahChatRoleNameAgreement(text);
            }
            if (msg != null) {
                AddFriendJframe.getAddFriendJframe().getAddFriendJpanel().CF(null);
                SendMessageUntil.toServer(msg);
            }
        } else if (index == 8) {// 断交
            Friendtable friend = FriendMsgJframe.getFriendMsgJframe().getMsgJpanel().getFriend();
            PlayerMonitor.deleteFriden(friend.getRolename());
        } else if (index == 9) {// 历史消息
            Friendtable friend = FriendMsgJframe.getFriendMsgJframe().getMsgJpanel().getFriend();
            FriendChatMessageJframe.getFriendChatMessageJframe().getJpanel()
                    .showFriend(friend, MessagrFlagUntil.getRichLabel(friend.getRolename()));
            // 打开聊天面板
            FormsManagement.showForm(56);
        } else if (index == 10) {
            Friendtable friend = FriendMsgJframe.getFriendMsgJframe().getMsgJpanel().getFriend();
            if ("发送消息".equals(this.getText())) {
                // 打开聊天面板
                FriendChatMessageJframe.getFriendChatMessageJframe().getJpanel()
                        .showFriend(friend, MessagrFlagUntil.getRichLabel(friend.getRolename()));
                FormsManagement.showForm(56);
                return;
            } else if ("申请入队".equals(this.getText())) {
                PlayerMonitor.teamApply(friend.getRole_id());
                return;
            }
            ManimgAttribute attribute = ImageMixDeal.huoquLogin(friend.getRolename());
            if (attribute == null) {
                ZhuFrame.getZhuJpanel().addPrompt2("玩家离你太远了");
                return;
            }
            if (friend.getRolename().equals(ImageMixDeal.userimg.getRoleShow().getRolename())) {
                ZhuFrame.getZhuJpanel().addPrompt2("不能对自己操作");
                return;
            }
            if ("交易".equals(this.getText())) {
                PlayerMonitor.transApply(friend.getRolename());
            }
        } else if (index == 11 || index == 12) {
            addFriendJpanel.labMenuChange(index);
        } else if ("确认".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 40) { //捐钱确认
        	DonationsJpanel.giveGangMoney();
        } else if ("取消".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 41) {	//捐钱取消
			DonationsJpanel.getGiveSumMoney().setText("");
            FormsManagement.HideForm(112);
        } else if ("搜 索".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 600) { //查询确认
            FindDropJpanel.findEnsure();
        } else if ("取 消".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 601) {	 //查询取消
            FindDropJpanel.getFindName().setText("");
            FormsManagement.HideForm(600);
        } else if ("搜索".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 600) { //查询确认(红木风格)
            FindDropJpanel.findEnsure();
        } else if ("取消".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 601) {	 //查询取消(红木风格)
            FindDropJpanel.getFindName().setText("");
            FormsManagement.HideForm(600);
        } else if ("搜 索".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 1101){
        	ChaojifeiListJpanel.findEnsure();
        } else if ("传送".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 1102){
            ChaojifeiListJpanel.iWantToFly();
        } else if ("搜索".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 2101){
        	GMshopJpanel.findEnsure();
        } else if ("发送".equals(this.getText()) && FightingMixDeal.State == HandleState.USUAL && index == 2102){
        	GMshopJpanel.iWantToFly();
        }else if (index == 3345){
        	MyQdModeJFrame.ggtd(null);
        }else if (index == 3346){
        	MyQdModeJFrame.ggt(null);
        }else if ("    ".equals(this.getText())) {//任我行相关
            //关闭世界地图二级菜单
            WorldMapJpanel.showIsTeamBtnSx(false, 0);
            WorldMapJpanel.showduyu(false, 0);
            WorldMapJpanel.showdayanta(false, 0);
            WorldMapJpanel.showfengcao(false, 0);
            WorldMapJpanel.showlongku(false, 0);

        	WorldMapJpanel.iWantToFlyGo(index);
        }else if (index == 30031) {//泡点
        	ExpAddMapJpanel.iWantToFlyGo(index);
        }else if (index == 30032) {
        	ExpAddMapJpanel.iWantToFlyGo(index);
        }else if (index == 30033) {
        	ExpAddMapJpanel.iWantToFlyGo(index);
        }else if (index == 30034) {
        	ExpAddMapJpanel.iWantToFlyGo(index);
        }else if (index == 1105 && !"重选".equals(this.getText()) && !"购买".equals(this.getText()) && !"刷新".equals(this.getText())) { //全民竞猜
        	LotteryCPJpanel.ChoiceNumber(this.getText());
        }else if (index == 1105 && "重选".equals(this.getText())) {
        	LotteryCPJpanel.emptyNumber();
        }else if (index == 1105 && "购买".equals(this.getText())) {
        	LotteryCPJpanel.purchaseNumber();
        }else if (index == 1105 && "刷新".equals(this.getText())) {
        	LotteryCPJpanel.refresh();
        }else if ("海底迷宫1".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showIsTeamBtnSx(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("海底迷宫2".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showIsTeamBtnSx(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("海底迷宫3".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showIsTeamBtnSx(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("海底迷宫4".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showIsTeamBtnSx(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("地狱迷宫1".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showduyu(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("地狱迷宫2".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showduyu(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("地狱迷宫3".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showduyu(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("地狱迷宫4".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showduyu(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("大雁塔一层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showdayanta(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("大雁塔二层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showdayanta(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("大雁塔三层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showdayanta(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("大雁塔四层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showdayanta(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("大雁塔五层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showdayanta(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("大雁塔六层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showdayanta(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("大雁塔七层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showdayanta(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("凤巢一层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showfengcao(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("凤巢二层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showfengcao(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("凤巢三层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showfengcao(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("凤巢四层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showfengcao(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("凤巢五层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showfengcao(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("凤巢六层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showfengcao(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("凤巢七层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showfengcao(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("龙窟一层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showlongku(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("龙窟二层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showlongku(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("龙窟三层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showlongku(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("龙窟四层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showlongku(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("龙窟五层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showlongku(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("龙窟六层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showlongku(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if ("龙窟七层".equals(this.getText())) {//世界地图扩展
            WorldMapJpanel.showlongku(false, 1);
            WorldMapJpanel.iWantToFlyGo(index);
        }else if (index >= 3011 && index <= 3030) {
            /**
             * 召唤兽自选礼包
             */
            String sendmes = Agreement.getAgreement().userAgreement("自选="+MyOptionalJpanel.zhjgood.getRgid()+"="+(index-3011));

            for (int i = 0; i < MyOptionalJpanel.labGoodsImgsxList.size(); i++) {
                if (MyOptionalJpanel.labGoodsImgsxList.get(i) != null) {
                    MyOptionalJpanel.labGoodsImgsxList.get(i).setIcon(null);
                    MyOptionalJframe.getMyOptionalJpanel().remove(MyOptionalJpanel.labGoodsImgsxList.get(i));
                    MyOptionalJframe.getMyOptionalJpanel().remove(MyOptionalJpanel.goodsnameList.get(i));
                }
            }
            SendMessageUntil.toServer(sendmes);
            FormsManagement.HideForm(3030);
            MyOptionalJpanel.zhjgood.goodxh(1);

        }else if (index >= 3011 && index <= 3030) {
            /**
             * 装备自选礼包
             */
            String sendmes = Agreement.getAgreement().userAgreement("自选="+MyOptionalJpanel1.zhjgood.getRgid()+"="+(index-3030));

            for(int i=0;i<MyOptionalJpanel1.labGoodsImgsx.length;i++) {
                if(MyOptionalJpanel1.labGoodsImgsx[i]!=null) {
                    MyOptionalJpanel1.labGoodsImgsx[i].setIcon(null);
                    MyOptionalJframe1.getMyOptionalJpanel1().remove(MyOptionalJpanel1.labGoodsImgsx[i]);
                    MyOptionalJframe1.getMyOptionalJpanel1().remove(MyOptionalJpanel1.goodsname[i]);
                }
            }
            SendMessageUntil.toServer(sendmes);
            FormsManagement.HideForm(3030);
            MyOptionalJpanel1.zhjgood.goodxh(1);
        }
    }

    /**
     * 任命
     */
    public void sureRenMing() {

        try {
            FactionCardJpanel factionCardJpanel = FactionMainJframe.getFactionMainJframe().getFactionMainJpanel()
                    .getFactionCardJpanel();
            factionCardJpanel
                    .getGangResultBean()
                    .getRoleTables()
                    .get(ApointJpanel.index)
                    .setGangpost(
                            ApointJframe
                                    .getApointJframe()
                                    .getapointJpanel()
                                    .getListModel()
                                    .get(ApointJframe.getApointJframe().getapointJpanel().getListposition()
                                            .getSelectedIndex()));
            factionCardJpanel.getFactionMemberJpanel().showMenuMessage(factionCardJpanel.getGangResultBean());
            String sendMes = Agreement.GangAppointAgreement(factionCardJpanel.getGangResultBean().getRoleTables()
                    .get(ApointJpanel.index).getRole_id()
                    + "|" + ApointJframe.getApointJframe().getapointJpanel().getListposition().getSelectedValue());
            // 向服务器发送信息
            SendMessageUntil.toServer(sendMes);
        } catch (Exception e2) {
            // TODO: handle exception
        }
        FormsManagement.HideForm(37);

    }

    /** 转换种族/转生 */
    public void sureZhuanSheng() {
        RaceChangeMainJpanel raceChangeMainJpanel = RaceChangeMainJframe.getRaceChangeMainJframe().getRaceChangeMainJpanel();

        int zhuantype = raceChangeMainJpanel.getLeixing();

        if (raceChangeMainJpanel.getSpecies_id() == null) {
            ZhuFrame.getZhuJpanel().addPrompt2("选中要转换的角色");
            return;
        }
        for (int i = 0; i < GoodsListFromServerUntil.getChoseGoodsList().length; i++) {
            if (GoodsListFromServerUntil.getChoseGoodsList()[i] != null) {// 先判断是否有穿装备
                if (zhuantype == 0) {
                    ZhuFrame.getZhuJpanel().addPrompt2("转换种族前必须要卸下所有装备！");
                } else {
                    ZhuFrame.getZhuJpanel().addPrompt2("转生前必须要卸下所有装备！");
                }
                return;
            }
        }
        int fly_id=0;
        fly_id=ImageMixDeal.userimg.getRoleShow().getFly_id();
        if (fly_id!=0){
           ZhuFrame.getZhuJpanel().addPrompt2("请先下飞行器！");
           return;
        }
        String sendmes = Agreement.getAgreement().RacialTransformationAgreement(
                zhuantype + "|" + raceChangeMainJpanel.getSpecies_id());
        SendMessageUntil.toServer(sendmes);
    }

    /**
     * 吐出内丹
     */
    public void spitOutNeDan() {
        // 判断召唤兽是否被加锁
        if (UserMessUntil.getChosePetMes().getPetlock() == 1) {
            ZhuFrame.getZhuJpanel().addPrompt(
                    "召唤兽" + UserMessUntil.getChosePetMes().getSummoningname() + "已被加锁，不可吐出内丹！！");
            return;
        }
        // 先判断背包是否还有空位
        int packNumber = GoodsListFromServerUntil.Surplussum("-1", "-1", 999);
        if (packNumber <= 0) {
            ZhuFrame.getZhuJpanel().addPrompt("背包已满！！！");
            return;
        }
        String strings[] = UserMessUntil.getChosePetMes().getInnerGoods().split("\\|");
        if (strings.length > 0) {
            String values = "";
            for (int i = 0; i < strings.length; i++) {
                if (ZhuJpanel.getNedangoods() != null && ZhuJpanel.getNedangoods().getRgid().compareTo(new BigDecimal(strings[i])) == 0) {
                    ZhuJpanel.getNedangoods().setStatus(0);
                    GoodsListFromServerUntil.fushis.remove(ZhuJpanel.getNedangoods().getRgid());
                    GoodsListFromServerUntil.newgood(ZhuJpanel.getNedangoods());
                    GoodsMouslisten.gooduse(ZhuJpanel.getNedangoods(), 0);
                    FormsManagement.HideForm(47);
                    ZhuJpanel.setNedangoods(null);
                } else {
                    if (!"".equals(values)) {
                        values = values + "|";
                    }
                    values = values + strings[i];
                }
            }

            UserMessUntil.getChosePetMes().setInnerGoods(values);
            ChangeMouseSymbolMouslisten.refreshNedan(UserMessUntil.getChosePetMes());
            SendRoleAndRolesummingUntil.sendRoleSumming(UserMessUntil.getChosePetMes());
        }

    }

    /** 转换经验 */
    public void conversionExp() {
        RoleSummoning pet = UserMessUntil.getChosePetMes();
        if (pet != null) {
            if (ZhuJpanel.getNedangoods().getRgid() == null) {
                ZhuFrame.getZhuJpanel().addPrompt2("没有选中的内丹");
            }
            BigDecimal  = new BigDecimal("5000000");//扣除经验
            String sendmes = Agreement.getAgreement().userpetAgreement("ND|" + pet.getSid() + "|" + ZhuJpanel.getNedangoods().getRgid());
            SendMessageUntil.toServer(sendmes);
        }
    }

    /**
     * 发送消息
     */
	private static long time;
    public void sendMessageUntil() {
        try {
            String text = FriendChatMessageJframe.getFriendChatMessageJframe().getJpanel().getSetwords().getText();
            if ("".equals(text)) {
                ZhuFrame.getZhuJpanel().addPrompt2("发送消息不能为空");
                return;
            }
            long time2 = System.currentTimeMillis();
			if (time2 - time < 2000) {
				ZhuFrame.getZhuJpanel().addPrompt("聊天间隔2秒！");
				return;
			}
			time = time2;
            FriendChatMessageJframe.getFriendChatMessageJframe().getJpanel().getSetwords().setText("");
            // 发送信息给服务器
            ChatBean chatBean = new ChatBean();
            chatBean.setRolename(ImageMixDeal.userimg.getRoleShow().getRolename());
            if (FriendChatMessageJpanel.getHyName() != null && !"".equals(FriendChatMessageJpanel.getHyName())) {
                chatBean.setFriendName(FriendChatMessageJpanel.getHyName());
            } else {
                chatBean.setFriendName(UserMessUntil.getChatFriendName());
            }
            chatBean.setMessage(text);
            chatBean.setTime(Util.getTime());
            String mes = Agreement.getAgreement()
                    .friendchatAgreement(GsonUtil.getGsonUtil().getgson().toJson(chatBean));
            // 向服务器发送信息
            SendMessageUntil.toServer(mes);
            // 发送成功将发送的信息添加到聊天记录框
            MessagrFlagUntil.ReceiveMessage(chatBean, chatBean.getFriendName());
        } catch (Exception e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
    }
}
